<?php

use yii\helpers\Html;
use yii\grid\GridView;
use app\models\FamilymemberModel;
use yii\data\ActiveDataProvider;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\FamilymemberSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '家庭情况';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="familymember-model-index">

    <h4>家庭信息</h4> 
 <?php if($familyModel==null):?>   
 <p>
  <?= Html::a('添加家庭信息', ['createinfo'], ['class' => 'btn btn-info']) ?>
 </p>
 <?php else :?>
<?= DetailView::widget([
        'model' => $familyModel,
        'attributes' => [
           // 'id',
            'stu_id',
            'address',
            'recipient',
            'postal_code',
            'economic_status',
            'load',
        ],
    ]) ?>
    <p>
  <?= Html::a('修改家庭信息', ['updateinfo'], ['class' => 'btn btn-info']) ?>
 </p>
    <?php endif;?>
    <h4>家庭成员信息</h4>
    <?php   $dataProvider = new ActiveDataProvider([
            'query' => FamilymemberModel::find()->where(['stu_id'=>$id]),
        ]);   ?> 
    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [    
            //'id',
            //'stu_id',
        	'name',
            'relate',
            'date_of_birth',
             'workplace',
             'duties',
             'telephone',
            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
    
    <p>
        <?= Html::a('添加家庭成员', ['create'], ['class' => 'btn btn-info']) ?>
    </p>
</div>
